home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / games / cambl25a.zip / wes.mst < prev   
Text File  |  1995-06-01  |  10KB  |  275 lines

  1. '**************************************************************************
  2. '*                       SETUP KHMER LESSON DEMODISK
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''Dialog ID's
  11. CONST WELCOME       = 100
  12. CONST ASKQUIT       = 200
  13. CONST DESTPATH      = 300
  14. CONST EXITFAILURE   = 400
  15. CONST EXITQUIT      = 600
  16. CONST EXITSUCCESS   = 700
  17. CONST OPTIONS       = 800
  18. CONST APPHELP       = 900
  19. CONST BADPATH       = 6400
  20.  
  21. ''Bitmap ID
  22. CONST LOGO = 1
  23.  
  24. GLOBAL DEST$        ''Default destination directory.
  25. GLOBAL WinDir$
  26. GLOBAL WinSysDir$
  27. GLOBAL OPTCUR$      ''Option selection from option dialog.
  28.  
  29. DECLARE SUB Install
  30. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  31.  
  32.  
  33. INIT:
  34.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  35.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  36.  
  37.     SetBitmap CUIDLL$, LOGO
  38.     SetTitle "Khmer Lesson Install - Installation de Khmer Lesson"
  39.  
  40.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  41.     IF szInf$ = "" THEN
  42.     szInf$ = GetSymbolValue("STF_CWDDIR") + "wes.inf"
  43.     END IF
  44.     ReadInfFile szInf$
  45.  
  46.     OPTCUR$ = "1"
  47.     DEST$ = "C:\DEMO\KHMER"
  48.  
  49. '$IFDEF DEBUG
  50.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  51.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  52.     IF IsDriveValid(WinDrive$) = 0 THEN
  53.     i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive. - Nom du lecteur incorrecte", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  54.     GOTO QUIT
  55.     END IF
  56. '$ENDIF ''DEBUG
  57.  
  58.  
  59. WELCOME:
  60.  
  61.  
  62. OPTION:
  63.     SetSymbolValue "RadioDefault", OPTCUR$
  64. OPTL1:
  65.     sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", APPHELP, HELPPROC$)
  66.     OPTCUR$ = GetSymbolValue("ButtonChecked")
  67.  
  68.     IF sz$ = "CONTINUE" THEN
  69.     UIPop(1)
  70.     ELSEIF sz$ = "REACTIVATE" THEN
  71.     GOTO OPTL1
  72.     ELSE
  73.     GOSUB ASKQUIT
  74.     GOTO OPTION
  75.     END IF
  76.  
  77.  
  78.  
  79. GETPATH:
  80.     SetSymbolValue "EditTextIn", DEST$
  81.     SetSymbolValue "EditFocus", "END"
  82. GETPATHL1:
  83.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  84.     DEST$ = GetSymbolValue("EditTextOut")
  85.  
  86.     IF sz$ = "CONTINUE" THEN
  87.     IF IsDirWritable(DEST$) = 0 THEN
  88.         GOSUB BADPATH
  89.         GOTO GETPATHL1
  90.     END IF
  91.     UIPop 1
  92.     ELSEIF sz$ = "REACTIVATE" THEN
  93.     GOTO GETPATHL1
  94.     ELSEIF sz$ = "BACK" THEN
  95.     UIPop 1
  96.     GOTO OPTION
  97.     ELSE
  98.     GOSUB ASKQUIT
  99.     GOTO GETPATH
  100.     END IF
  101.  
  102.  
  103.     Install
  104.  
  105.  
  106. QUIT:
  107.     ON ERROR GOTO ERRQUIT
  108.  
  109.     IF ERR = 0 THEN
  110.     dlg% = EXITSUCCESS
  111.     ELSEIF ERR = STFQUIT THEN
  112.     dlg% = EXITQUIT
  113.     ELSE
  114.     dlg% = EXITFAILURE
  115.     END IF
  116. QUITL1:
  117.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  118.     IF sz$ = "REACTIVATE" THEN
  119.     GOTO QUITL1
  120.     END IF
  121.     UIPop 1
  122.  
  123.     END
  124.  
  125. ERRQUIT:
  126.     IF OPTCUR$ = "1" THEN
  127.     i% = DoMsgBox("Setup sources were corrupted, please read file Dealer.wri and contact your local reseller.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  128.     ELSE
  129.     i% = DoMsgBox("Les fichiers Setup sont endommagΘs, lisez le fichier Contacts.wri et contacter votre revendeur le plus proche.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  130.     END IF
  131. END
  132.  
  133.  
  134.  
  135. BADPATH:
  136.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  137.     IF sz$ = "REACTIVATE" THEN
  138.     GOTO BADPATH
  139.     END IF
  140.     UIPop 1
  141.     RETURN
  142.  
  143.  
  144.  
  145. ASKQUIT:
  146.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  147.  
  148.     IF sz$ = "EXIT" THEN
  149.     UIPopAll
  150.     ERROR STFQUIT
  151.     ELSEIF sz$ = "REACTIVATE" THEN
  152.     GOTO ASKQUIT
  153.     ELSE
  154.     UIPop 1
  155.     END IF
  156.     RETURN
  157.  
  158.  
  159.  
  160. '**
  161. '** Purpose:
  162. '**     Builds the copy list and performs all installation operations.
  163. '** Arguments:
  164. '**     none.
  165. '** Returns:
  166. '**     none.
  167. '*************************************************************************
  168. SUB Install STATIC
  169.  
  170.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  171.     CreateDir DEST$, cmoNone
  172.     CreateDir DEST$+"\ttf", cmoNone
  173.     CreateDir DEST$+"\Info", cmoNone
  174.     CreateDir DEST$+"\files", cmoNone
  175.     CreateDir DEST$+"\Dict", cmoNone
  176.  
  177.     OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
  178.     WriteToLogFile ""
  179.     WriteToLogFile "  User chose as destination directory: '" + DEST$ + "'"
  180.     WriteToLogFile "  User chose option: '" + OPTCUR$ + "'"
  181.     WriteToLogFile ""
  182.     WriteToLogFile "May have had to create the directory: " + DEST$
  183.     WriteToLogFile ""
  184.  
  185.     WriteToLogFile "I will add section Lesson Add  "
  186.     WinDir$ = GetWindowsDir()
  187.     WinSysDir$ = GetWindowsSysDir()       
  188.     AddSectionFilesToCopyList "WesLesson", SrcDir$, DEST$
  189.     AddSectionFilesToCopyList "WesFiles", SrcDir$, DEST$
  190.     AddSectionFilesToCopyList "Ttf", SrcDir$, DEST$+"\ttf"
  191. IF OPTCUR$ = "1" THEN
  192.     AddSectionFilesToCopyList "InfoGB", SrcDir$, DEST$+"\Info"
  193. ELSE
  194.     AddSectionFilesToCopyList "InfoFF", SrcDir$, DEST$+"\Info"
  195. END IF
  196.  
  197.     AddSectionFilesToCopyList "Files", SrcDir$, DEST$
  198.     CopyFilesInCopyList
  199.     ini$ = GetWindowsDir()+"CALKHMER.INI"
  200.     CreateIniKeyValue ini$, "CDROM", "CDROM", "NO" , cmoOverwrite
  201.     CreateIniKeyValue ini$, "VisualOption", "Langue", "khmer" , cmoOverwrite
  202.     CreateIniKeyValue ini$, "Lesson", "First", "0" , cmoOverwrite
  203.     CreateIniKeyValue ini$, "Lesson", "Guide", "1" , cmoOverwrite
  204.     CreateIniKeyValue ini$, "Lesson", "Item", "0" , cmoOverwrite
  205.     CreateIniKeyValue ini$, "Option", "Sounds", "2" , cmoOverwrite
  206.     CreateIniKeyValue ini$, "OptionExercise", "Sounds", "2" , cmoOverwrite
  207.     CreateIniKeyValue ini$, "Lesson", "Phonetic", "1" , cmoOverwrite
  208.     CreateIniKeyValue ini$, "Lesson", "LessonType", "0" , cmoOverwrite
  209.     CreateIniKeyValue ini$, "Lesson", "DigitalVideo", "1" , cmoOverwrite 
  210.     CreateIniKeyValue ini$, "CurrentLesson", "Menu", "1580" , cmoOverwrite
  211.     CreateIniKeyValue ini$, "ZipFiles", "DelSoundPicture", "YES" , cmoNone
  212.     CreateIniKeyValue ini$, "ZipFiles", "DirectAcess", "NO" , cmoNone
  213.     CreateProgmanGroup "Khmer Lesson", "", cmoNone
  214.     ShowProgmanGroup  "Khmer Lesson", 1, cmoNone
  215.     CreateProgmanItem "Khmer Lesson", "Demo Khmer Lesson", MakePath(DEST$,"Course.exe"), "", cmoOverwrite
  216.     CreateIniKeyValue ini$, "PictExercise", "Language", "khmer" , cmoOverwrite
  217.     CreateIniKeyValue ini$, "TranslateEx", "From", "khmer" , cmoOverwrite
  218.     CreateIniKeyValue ini$, "Police", "FirstFont", "Ekreach" , cmoOverwrite
  219.     CreateIniKeyValue ini$, "Police", "Size", "50" , cmoOverwrite
  220. IF OPTCUR$ = "1" THEN
  221.     CreateIniKeyValue ini$, "TranslateEx", "To", "anglais" , cmoOverwrite
  222.     CreateIniKeyValue ini$, "Dictionnary", "From", "khmer" , cmoOverwrite
  223.     CreateIniKeyValue ini$, "Dictionnary", "To", "anglais" , cmoOverwrite
  224.     CreateIniKeyValue ini$, "Option", "Phonetic", "anglais " , cmoOverwrite
  225.     CreateIniKeyValue ini$, "Option", "Traduction", "anglais " , cmoOverwrite
  226.     CreateIniKeyValue ini$, "Lesson", "Langue", "2" , cmoOverwrite
  227.     CreateProgmanItem "Khmer Lesson", "Khmer Lesson Help", "winhelp.exe "+MakePath(DEST$,"lessongb.hlp"), "", cmoOverwrite
  228.     CreateProgmanItem "Khmer Lesson", "Demo Khmer Lesson Exercises", MakePath(DEST$,"Exercise.exe"), "", cmoOverwrite
  229.     CreateProgmanItem "Khmer Lesson", "Your technical support", "write.exe "+MakePath(DEST$+"\Info","suppgb.wri"), "", cmoOverwrite
  230.     CreateProgmanItem "Khmer Lesson", "To order Khmer Lesson", "write.exe "+MakePath(DEST$+"\Info","softgb.wri"), "", cmoOverwrite
  231.     CreateProgmanItem "Khmer Lesson", "To order Khmer Fonts", "write.exe "+MakePath(DEST$+"\Info","fontgb.wri"), "", cmoOverwrite
  232.     CreateProgmanItem "Khmer Lesson", "List of khmer characters", "write.exe "+MakePath(DEST$+"\Info","ekgb.wri"), "", cmoOverwrite
  233. ELSE
  234.     CreateIniKeyValue ini$, "TranslateEx", "To", "francais" , cmoOverwrite
  235.     CreateIniKeyValue ini$, "Dictionnary", "From", "khmer" , cmoOverwrite
  236.     CreateIniKeyValue ini$, "Dictionnary", "To", "francais" , cmoOverwrite
  237.     CreateIniKeyValue ini$, "Option", "Phonetic", "francais" , cmoOverwrite
  238.     CreateIniKeyValue ini$, "Option", "Traduction", "francais" , cmoOverwrite
  239.     CreateIniKeyValue ini$, "Lesson", "Langue", "1" , cmoOverwrite
  240.     CreateProgmanItem "Khmer Lesson", "Aide Khmer Lesson", "winhelp.exe "+MakePath(DEST$,"lessonff.hlp"), "", cmoOverwrite
  241.     CreateProgmanItem "Khmer Lesson", "Demo Khmer Lesson Exercices", MakePath(DEST$,"Exercise.exe"), "", cmoOverwrite
  242.     CreateProgmanItem "Khmer Lesson", "Votre support technique", "write.exe "+MakePath(DEST$+"\Info","suppff.wri"), "", cmoOverwrite
  243.     CreateProgmanItem "Khmer Lesson", "Pour commander Khmer Lesson", "write.exe "+MakePath(DEST$+"\Info","softff.wri"), "", cmoOverwrite
  244.     CreateProgmanItem "Khmer Lesson", "Pour commander les polices de caractΦres KhmΦres", "write.exe "+MakePath(DEST$+"\Info","fontff.wri"), "", cmoOverwrite
  245.     CreateProgmanItem "Khmer Lesson", "Liste des caractΦres khmΦres", "write.exe "+MakePath(DEST$+"\Info","ekff.wri"), "", cmoOverwrite
  246.     CreateProgmanItem "Khmer Lesson", "A propos de khmer Lesson Demodisk", "write.exe "+MakePath(DEST$+"\Info","limite.wri"), "", cmoOverwrite
  247. END IF
  248. AddDos5Help "YOURAPP", "A brief help text for your Windows application."+chr$(10)+"It can be continued on another line with chr$(10).", cmoNone
  249. CloseLogFile
  250. END SUB
  251.  
  252.  
  253.  
  254. '**
  255. '** Purpose:
  256. '**     Appends a file name to the end of a directory path,
  257. '**     inserting a backslash character as needed.
  258. '** Arguments:
  259. '**     szDir$  - full directory path (with optional ending "\")
  260. '**     szFile$ - filename to append to directory
  261. '** Returns:
  262. '**     Resulting fully qualified path name.
  263. '*************************************************************************
  264. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  265.     IF szDir$ = "" THEN
  266.     MakePath = szFile$
  267.     ELSEIF szFile$ = "" THEN
  268.     MakePath = szDir$
  269.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  270.     MakePath = szDir$ + szFile$
  271.     ELSE
  272.     MakePath = szDir$ + "\" + szFile$
  273.     END IF
  274. END FUNCTION
  275.